<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>{$Think.config.website.name}后台管理</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico"> <link href="__BACKEND__/static/css/bootstrap.min.css" rel="stylesheet">
    <link href="__BACKEND__/static/css/font-awesome.css" rel="stylesheet">

    <link href="__BACKEND__/static/css/animate.css" rel="stylesheet">
    <link href="__BACKEND__/static/css/style.css" rel="stylesheet">

    <script>if(window.top !== window.self){ window.top.location = window.location;}</script>
</head>

<body class="gray-bg">

    <div class="middle-box text-center loginscreen animated fadeInDown">
        <div>
            <div>

                <h1 class="logo-name">SN</h1>

            </div>
            <h3>欢迎使用{$Think.config.website.name}后台管理</h3>

            <div class="m-t" role="form">
                <div class="form-group">
                    <input type="account" class="form-control" placeholder="用户名" id="account" required>
                </div>
                <div class="form-group">
                    <input type="password" class="form-control" placeholder="密码" id="password" required>
                </div>
                <button type="button" id="submit" class="btn btn-primary block full-width m-b">登 录</button>
                </p>

            </div>
        </div>
    </div>

    <!-- 全局js -->
    <script src="__BACKEND__/static/js/jquery.min.js?v=2.1.4"></script>
    <script src="__BACKEND__/static/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="__BACKEND__/static/js/plugins/layer/layer.min.js"></script>

    <script type="text/javascript">
    $(function() {

        document.onkeydown = function (e) {
            var ev = document.all ? window.event : e;
            if (ev.keyCode == 13) {
                $('#submit').click();
                return false;
            }
        }
        
        $('#submit').on('click', function() {
            var account = $('#account').val();
            var password = $('#password').val();
            $.post("{:url('admin/Login/login')}",{account:account,password:password},function(result){
                if(result.code == 200){
                    layer.msg('登陆成功', {
                          time: 1000 
                        }, function(){
                          window.location.href="{:url('admin/Index/index')}";
                        });
                    
                }else{            
                    layer.msg(result.message); 
                    $('#password').val("");
                }       
            });
        });
    });
    </script>
    

</body>

</html>
